package com.exercise.test;

import com.github.cosycode.imgtool.rule.FileExistCheckBRO;
import com.github.cosycode.imgtool.tool.ImageCheckTool;
import com.github.cosycode.imgtool.tool.RegexUtils;
import com.github.cosycode.imgtool.tool.TxtFileFormatterTool;
import com.github.cosycode.imgtool.util.PathUtils;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;

import java.io.File;
import java.util.function.UnaryOperator;

/**
 * <b>Description : </b>
 * <p>
 * <b>created in </b> 2022/1/7
 * </p>
 *
 * @author CPF
 * @since 1.0
 **/
public class test {

    @Test
    public void mainTest() {
        final UnaryOperator<String> stringUnaryOperator = path -> {
            path = path.trim();
            final PathUtils.PathType pathType = PathUtils.getPathType(path);
            if (pathType == PathUtils.PathType.RELATION_PATH) {

            }
            return null;
        };
        TxtFileFormatterTool.FormatRule formatRule = new TxtFileFormatterTool.FormatRule(RegexUtils.MARKDOWN_IMG_REGEX_DIRECTOR, stringUnaryOperator);
    }


    @Test
    public void test2() {
        String url = "https://upload-images.jianshu.io/upload_images/4760019-75512e785d2fc355.png?imageMogr2/auto-orient/strip|imageView2/2/w/862/format/webp";
        FileExistCheckBRO analyze = FileExistCheckBRO.analyze(url, true);
        System.out.println(analyze);
    }

    @Test
    public void test3() {
        System.out.println(ImageCheckTool.isImage(new File("D:\\Users\\Desktop\\新建文件夹\\feb77fdbe7203020f4199f429e392820.PNG")));
    }

}
